function curry(fn, ...args) {
  const curried = (...rest) => {
    return curry.call(null, fn, ...args, ...rest)
  }
  curried.toString = function () {
    return fn.call(null, ...args)
  }
  return curried
}

function fn(...args) {
  return args.reduce((pre, cur) => pre + cur, 0)
}

let add = curry(fn, 1)
console.log(add.toString());
console.log(add(2, 4)(1)(1)(1)(1).toString());